<template>
  <view class="new" style="margin: 20upx">
    <view class="article">
      <view class="title-more flex-between">
        <view class="title"
          ><image src="/static/icon/new.png" mode="widthFix"></image> 最新发布
        </view>
        <view class="more">
          <navigator url="/pages/index/all/all">查看全部</navigator>
        </view>
      </view>
      <view class="article-list">
        <view
          class="item br10"
          v-for="(v, i) in articleNewlList.slice(0, 3)"
          :key="v.id"
          @click="HandleView(v.id)"
        >
          <view class="a-title t2">
            {{ v.title }}
          </view>
          <view class="nav-item">
            <view
              class="cover br10"
              :style="{ backgroundImage: 'url(' + v.cover + ')' }"
            >
            </view>
            <view class="info">
              <view class="title t2">
                {{ v.content }}
              </view>
              <view class="tag-list flex">
                <view
                  class="padding-md"
                  v-for="(item, index) in v.label_list"
                  :key="index"
                >
                  <view class="cu-tag sm light bg-purple">{{
                    item.title
                  }}</view>
                </view>
              </view>
              <view class="tag-time flex-between">
                <view class="eye"> {{ v.view_num }}阅读 </view>

                <view class="time"> {{ v.create_at }} </view>
              </view>
            </view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  props: ["articleNewlList"],
  methods: {
    HandleView(id) {
      let avatar = uni.getStorageSync("avatar")
      if (!avatar) {
        uni.navigateTo({
          url: "/pages/login/login",
        })
        return
      }
      uni.navigateTo({
        url: "/pages/detail/detail?id=" + id,
      })
    },
  },
}
</script>

<style lang="scss" scoped></style>
